#ifndef _RANDOM_H
#define _RANDOM_H

#include "common_h.h"

#if RAND_DEBUG > 0
#define   rand_debug         lite_printf
#else 
#define   rand_debug(fmt,...) 	;
#endif

#define	K_COBRA_DATA_SIZE						( 16 * K_COBRA_ONE_KB )

#define	K_COBRA_INTNUM_RNG						MML_INTNUM_TRNG

/** TRNG wait loops number for wanted bit to be released */
#define	K_COBRA_TRNG_WAIT_LOOPS					10000
#define	K_COBRA_TRNG_MAX_WAIT_LOOP				100000

/** TRNG row maximum size - in Bytes */
#define	K_COBRA_TRNG_MAX_WIDTH_BYTES			0x10
#define	K_COBRA_TRNG_MAX_WIDTH_INTEGER			( K_FLORA_TRNG_MAX_WIDTH_BYTES / sizeof(unsigned int) )

#define	K_COBRA_USECASE_TRNG_AES_KEY_SIZE		0x10



typedef enum
{
	N_COBRA_TRNG_ERR_MIN = COBRA_TRNG_BASE_ERR,
	/** Error Code: TRNG internal failure */
	N_COBRA_TRNG_ERR_FAILURE,
	/** Error Code: Generic error for unknown behavior */
	N_COBRA_TRNG_ERR_UNKNOWN,
	N_COBRA_TRNG_ERR_MAX = N_COBRA_TRNG_ERR_UNKNOWN

} e_cobra_trng_errors;

int trng_gen_aes_key(unsigned char *p_pucKey, unsigned int p_uiLength);
int trng_read(unsigned int *p_random, unsigned int length);
int trng_aes_keygen(void);
u8  trng_check_aes_valid(void);
#endif	

